package com.ruoyi.StarStudio.Mapper;

import com.ruoyi.StarStudio.Domain.Expert;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ExpertMapper {

    //查询全部专家信息
    @Select("select * from expert")
    public List<Expert> findAll();

    List<Expert> getList(Expert expert);

    //根据专家id查询专家信息
    @Select("select * from expert where id = #{id}")
    public Expert findById(Integer id);

    //增加专家信息
    @Insert("insert into expert values (null, #{name}, #{img}, #{info}, #{contact})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")  //设置主键自增，指定主键对应的实体类属性名和数据库字段名
    public int add(Expert expert);

    //修改专家信息
    @Update("update expert set name=#{name},img=#{img},info = #{info},contact=#{contact}  where id = #{id}")
    public void update(Expert expert);

    //删除专家信息
    @Delete("delete from expert where id = #{id}")
    public void delete(Integer id);
}
